< previous page page_366 next page >

Page 366
Quiz
1. Describe the difference between a property and a method.
2. What is the top-level data-access object (DAO)?
3. What command would you issue to repair a database? Is this a method or a property?
4. What is the syntax of the CompactDatabase method?
5. What happens if you don't declare a Workspace when you open a database?
6. What data object types can be created with the OpenRecordset method?
7. Which TableDef method can be used to create a table in an existing database? What syntax does this method follow?
8. Which data-access object would you use to determine the data type of a table column?
9. Can you use the Index data object to build an index for a FoxPro 2.5 database?
10. What information does the QueryDef object store?
Exercise
Assume that you are a systems consultant to a large multinational corporation. You have been assigned the task of building a program in Visual Basic that creates a database to handle customer information. In this database, you need to track CustomerID, Name, Address (two lines), City, State/Province, Zip, Phone, and Customer Type.
Start a new project and add a single command button to a form that executes the code to build this database. Include the following in your code:
· A section that deletes the database if it already exists
· A table for customer information (called Customers) and a table for customer types (called CustomerTypes)
· Primary keys for both tables
· A relationship between the two tables on the Customer Type field
· A message that signifies that the procedure is complete
When you have completed the entry of this code, display the database in Visdata. Add information to both tables. Take note of how the referential integrity is enforced by deleting records from the CustomerTypes table that are used in the Customers table.

 
< previous page page_366 next page >

If you like this book, buy it!